package com.unknownman.block.mapper;

import com.unknownman.block.entity.TTokenErc20;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.unknownman.block.vo.ERC20HourHoldVO;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import org.cloud.vo.JavaBeanResultMap;

/**
 * <p>
 * ERC20代币持仓信息 Mapper 接口
 * </p>
 *
 * @author xhy
 * @since 2021-10-18
 */
public interface TTokenErc20Mapper extends BaseMapper<TTokenErc20> {

    /**
     * 累加用户持有指定ERC20合约代币数量
     *
     * @param contractConfigId
     * @param owner
     * @param increaseValue
     * @param increaseValue
     * @param oldValue
     * @return
     */
    int updateTokenValue(@Param("contractConfigId") Long contractConfigId, @Param("owner") String owner,
        @Param("increaseValue") BigDecimal increaseValue, @Param("oldValue") BigDecimal oldValue);

    /**
     * 按小时统计代币的持有量和持币地址数
     *
     * @return
     */
    List<ERC20HourHoldVO> queryTokenErc20ByHour(@Param("tokenAddress") String tokenAddress);


    List<JavaBeanResultMap> countTokenTotalByOwner(Map<String, Object> params);


}
